package com.mysoft.gfyx.clue.mip.dto;

import com.mysoft.gfyx.clue.mip.dto.SearchBaseRequestDto;
import lombok.Data;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

@Data
public class OpSubscriptionRequestDto extends SearchBaseRequestDto {
    private String provinceCode;

    private String cityCode;

    private String receiverGUID;

    /**
     * 报名状态
     */
    private String applyStatus;
    /**
     * 信息类型
     */
    private String sourceCode;

    /**
     * 企业类型标签
     */
    private String companyType;

    /**
     * 联系方式：座机、手机号
     */
    private String phoneType;

    /**
     * 采购金额：区间
     */
    private Float purchaseAmountMin;
    private Float purchaseAmountMax;

    private String customerName;


    private Integer page;

    private Integer pageSize;

    private Integer offset;

    private Integer isNeedLimit = 1;


    protected void setFilterByField(String field, String operatorType, Object value) {
        switch (field) {
            case "purchaseAmount":
                if ("ge".equals(operatorType) || "gt".equals(operatorType)) {
                    this.setPurchaseAmountMin(Float.parseFloat(value.toString()));
                } else if ("le".equals(operatorType) || "lt".equals(operatorType)) {
                    this.setPurchaseAmountMax(Float.parseFloat(value.toString()));
                }
                break;
            default:
                this.dynamicSetProperty(field, value);
        }
    }


}
